package com.ap.autobase.repository.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ap.autobase.domain.Order;
import com.ap.autobase.repository.OrderDao;

@Transactional
@Repository
public class OrderDaoImpl extends GenericDaoImpl<Order, Integer> implements OrderDao {

	
	public Order getOrderByIdentificator(String identificator) {
		Criteria cr = getSession().createCriteria(Order.class, "order")
				.add(Restrictions.eq("identificator", identificator));
		return (Order) cr.uniqueResult();
	}
	
	public Order getOrderById(int id) {
		Criteria cr = getSession().createCriteria(Order.class, "order").add(Restrictions.eq("id", id));
		return (Order) cr.uniqueResult();
	}

}
